<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>备忘录</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="app">
        <input type="text" v-model="msg" placeholder="请输入消息"/>
        <button @click="add">添加</button>
        <ul v-show="msgs.length>0">
            <li v-for="(item,index) in msgs">
                {{item}}<button @click="msgs.splice(index,1)">删除</button>
            </li>
        </ul>
        <p v-show="msgs.length==0">未添加备忘录信息</p>
    </div>
</body>
</html>
<script>
    new Vue({
        el: '#app',
        data: {
            msg: '',
            msgs: []
        },
        methods: {
            add(){
                this.msgs.push(this.msg)
                this.msg = ''
            }
        }
    })
</script>